home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
case.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
4KB
|
67 lines
ccccaaaasssseeee((((nnnn)))) TTTTccccllll ((((7777....0000)))) ccccaaaasssseeee((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
case - Evaluate one of several scripts, depending on a given
value
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? _p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?
ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? {_p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?}
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_N_o_t_e: _t_h_e ccccaaaasssseeee _c_o_m_m_a_n_d _i_s _o_b_s_o_l_e_t_e _a_n_d _i_s _s_u_p_p_o_r_t_e_d _o_n_l_y _f_o_r
_b_a_c_k_w_a_r_d _c_o_m_p_a_t_i_b_i_l_i_t_y. _A_t _s_o_m_e _p_o_i_n_t _i_n _t_h_e _f_u_t_u_r_e _i_t _m_a_y
_b_e _r_e_m_o_v_e_d _e_n_t_i_r_e_l_y. _Y_o_u _s_h_o_u_l_d _u_s_e _t_h_e sssswwwwiiiittttcccchhhh _c_o_m_m_a_n_d
_i_n_s_t_e_a_d.
The ccccaaaasssseeee command matches _s_t_r_i_n_g against each of the _p_a_t_L_i_s_t
arguments in order. Each _p_a_t_L_i_s_t argument is a list of one
or more patterns. If any of these patterns matches _s_t_r_i_n_g
then ccccaaaasssseeee evaluates the following _b_o_d_y argument by passing
it recursively to the Tcl interpreter and returns the result
of that evaluation. Each _p_a_t_L_i_s_t argument consists of a
single pattern or list of patterns. Each pattern may
contain any of the wild-cards described under ssssttttrrrriiiinnnngggg mmmmaaaattttcccchhhh.
If a _p_a_t_L_i_s_t argument is ddddeeeeffffaaaauuuulllltttt, the corresponding body
will be evaluated if no _p_a_t_L_i_s_t matches _s_t_r_i_n_g. If no
_p_a_t_L_i_s_t argument matches _s_t_r_i_n_g and no default is given,
then the ccccaaaasssseeee command returns an empty string.
Two syntaxes are provided for the _p_a_t_L_i_s_t and _b_o_d_y
arguments. The first uses a separate argument for each of
the patterns and commands; this form is convenient if
substitutions are desired on some of the patterns or
commands. The second form places all of the patterns and
commands together into a single argument; the argument must
have proper list structure, with the elements of the list
being the patterns and commands. The second form makes it
easy to construct multi-line case commands, since the braces
around the whole list make it unnecessary to include a
backslash at the end of each line. Since the _p_a_t_L_i_s_t
arguments are in braces in the second form, no command or
variable substitutions are performed on them; this makes
the behavior of the second form different than the first
form in some cases.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
case, match, regular expression
Page 1 (printed 7/17/95)